package com.huawei.sort_algorithm;

//冒泡排序
public class BubbleSort {
    public static void bubbleSort(int[] array) {
        //需进行length-1次冒泡
        for(int i=0;i<array.length-1;i++)
        {
            for(int j=0;j<array.length-1-i;j++)
            {
                if(array[j]>array[j+1])
                {
                    int temp=array[j];
                    array[j]=array[j+1];
                    array[j+1]=temp;
                }
            }
        }
    }
}
